package com.itheima.stock.config;

import com.google.common.util.concurrent.RateLimiter;
import com.itheima.stock.properties.IdWorkerProperties;
import com.itheima.stock.properties.LimiterProperties;
import com.itheima.stock.util.IdWorkers;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *  id生成器
 */
@Configuration
@SuppressWarnings("all")
public class RateLimiterConfiguration {

    @Bean
    public RateLimiter rateLimiter(LimiterProperties limiterProperties){
        return RateLimiter.create(limiterProperties.getConcurrentNum());
    }

}
